<?php
namespace app\common\behavior;
use \think\Request;
class Initapp
{
    public function run(&$request)
    {
      //可初始化系统注册等操作
    }


//    protected function setRoute()
//    {
//        $list = db('Rewrite')->select();
//        foreach ($list as $key => $value) {
//            $route[$value['rule']] = $value['url'];
//        }
//        $model = db('Model');
//        $map = array(
//            'status' => array('gt', 0),
//            'extend' => array('gt', 0),
//        );
//        $list = $model->where($map)->field("name,id,title,'' as 'style'")->select();
//        foreach ($list as $key => $value) {
//            $route["admin/" . $value['name'] . "/index"] = "admin/content/index?model_id=" . $value['id'];
//            $route["admin/" . $value['name'] . "/add"] = "admin/content/add?model_id=" . $value['id'];
//            $route["admin/" . $value['name'] . "/edit"] = "admin/content/edit?model_id=" . $value['id'];
//            $route["admin/" . $value['name'] . "/del"] = "admin/content/del?model_id=" . $value['id'];
//            $route["admin/" . $value['name'] . "/status"] = "admin/content/status?model_id=" . $value['id'];
//            $route[$value['name'] . "/index"] = "index/content/index?model=" . $value['name'];
//            $route[$value['name'] . "/list/:id"] = "index/content/lists?model=" . $value['name'];
//            $route[$value['name'] . "/detail-<id>"] = "index/content/detail?model_id=" . $value['id'];
//            $route["user/" . $value['name'] . "/index"] = "user/content/index?model_id=" . $value['id'];
//            $route["user/" . $value['name'] . "/add"] = "user/content/add?model_id=" . $value['id'];
//            $route["user/" . $value['name'] . "/edit"] = "user/content/edit?model_id=" . $value['id'];
//            $route["user/" . $value['name'] . "/del"] = "user/content/del?model_id=" . $value['id'];
//            $route["user/" . $value['name'] . "/status"] = "user/content/status?model_id=" . $value['id'];
//        }
//        $route["list/:id"] = "index/content/category";
//        \think\Route::rule($route);
//    }
}